package com.dcy.prototype.improve;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @Author：dcy
 * @Description: 羊
 * @Date: 2021/1/20 15:26
 */
@Getter
@Setter
@ToString
public class Sheep implements Cloneable {

    private String name;
    private Integer age;
    private String color;
    private Sheep friend; // 是个对象,颗龙是如何处理

    public Sheep(String name, Integer age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    /**
     * 克隆该实例，使用默认的clone方法来完成
     *
     * @return
     */
    @Override
    protected Object clone() {
        Sheep sheep = null;
        try {
            sheep = (Sheep) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return sheep;
    }
}
